// ============================================================================
//
// Copyright (C) 2006-2007 Dengues
//
// Google Group: http://groups.google.com/group/dengues
// QQ Group: 24885404
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// ============================================================================
package org.dengues.designer.core.sqldb;

/**
 * Qiang.Zhang.Adolf@gmail.com class global comment. Detailled comment <br/>
 * 
 * $Id: Dengues.epf 1 2006-09-29 17:06:40Z qiang.zhang $ .Load and save HSQLDB server connection parameters from a Java
 * Project
 */
public class SqldbParams {

    // property names
    public static final String P_PORT_VALUE = "serverPort"; //$NON-NLS-1$

    public static final String P_NAME = "org.dengues.hsqldb.ui"; //$NON-NLS-1$

    public static final String P_USER_VALUE = "serverUser"; //$NON-NLS-1$

    public static final String P_PASSWD_VALUE = "serverPasswd"; //$NON-NLS-1$

    private int port = 9001;

    private String user = "sa"; //$NON-NLS-1$

    private String password = ""; //$NON-NLS-1$

    private String driver = "org.hsqldb.jdbcDriver"; //$NON-NLS-1$

    private String serverClass = "org.hsqldb.Server"; //$NON-NLS-1$

    private String host = "127.0.0.1"; //$NON-NLS-1$

    public SqldbParams() {
    }

    // public HsqldbParams(IJavaProject javaProject) throws CoreException {
    // load(javaProject);
    // }
    //
    // public void save(IJavaProject javaProject) throws CoreException {
    // IProject project = javaProject.getProject();
    // project.setPersistentProperty(new QualifiedName(P_NAME, P_PORT_VALUE), Integer.toString(port));
    // project.setPersistentProperty(new QualifiedName(P_NAME, P_USER_VALUE), user);
    // project.setPersistentProperty(new QualifiedName(P_NAME, P_PASSWD_VALUE), password);
    // }
    //
    // public void load(IJavaProject javaProject) throws CoreException {
    // IProject project = javaProject.getProject();
    // String property = project.getPersistentProperty(new QualifiedName(P_NAME, P_PORT_VALUE));
    // port = (property != null && property.length() > 0) ? Integer.parseInt(property) : port;
    // property = project.getPersistentProperty(new QualifiedName(P_NAME, P_USER_VALUE));
    // user = (property != null && property.length() > 0) ? property : user;
    // property = project.getPersistentProperty(new QualifiedName(P_NAME, P_PASSWD_VALUE));
    // password = (property != null && property.length() > 0) ? property : password;
    // }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public String getDriver() {
        return this.driver;
    }

    public void setDriver(String driver) {
        this.driver = driver;
    }

    public String getServerClass() {
        return this.serverClass;
    }

    public void setServerClass(String serverClass) {
        this.serverClass = serverClass;
    }

    public String getHost() {
        return this.host;
    }

    public void setHost(String host) {
        this.host = host;
    }
}
